<?php

Route::group(['prefix' => 'auth'], function () {
    Route::any('test', 'AuthController@test');//TODO test
    Route::any('test1', 'AuthController@test1');//TODO test

    Route::any('login', 'AuthController@login');
    Route::any('official_account_login', 'AuthController@officialAccountLogin');
});

Route::group(['middleware' => ['auth:api']], function() {
    Route::post('upload', 'CommonController@upload');
    Route::post('encryptor', 'CommonController@encryptor');
    Route::get('recommend ', 'CommonController@getRecommend');
    Route::get('page', 'CommonController@getPageConfig');
    Route::get('upload_config', 'CommonController@getUpLoadConfig');
    Route::get('rebate_rule', 'CommonController@getRebateRule');

    Route::get('banner', 'CommonController@getBanner');
    Route::get('category', 'CommonController@getCategory');
    Route::get('query_category', 'CommonController@queryCategory');
    Route::get('query_params', 'CommonController@queryParams');

    Route::group(['prefix' => 'shop'], function () {
        Route::get('', "ShopController@getShopList");
        Route::get('detail', "ShopController@detail");
        Route::get('banner', "ShopController@getBanner");
        Route::get('sample', 'ShopController@sample');
        Route::post('goods', 'ShopController@getGoodsList');
        Route::get('recommend', 'ShopController@getRecommend');
        Route::get('category', 'ShopController@getCategory');
        Route::post('reply', 'ShopController@reply');
        Route::get('comment', 'ShopController@getComment');
        Route::get('params', 'ShopController@getParams');
    });

    Route::group(['prefix' => 'package'], function () {
        Route::post('', "PackageController@getPackageList");
        Route::get('explosive', "PackageController@getExplosivePackage");
        Route::get('detail', "PackageController@detail");
        Route::get('spec', "PackageController@getSpecs");
        Route::post('order', "PackageController@createOrder")->middleware('check.unionid');
        Route::get('visitor', "PackageController@visitor");
        Route::get('share', "PackageController@share");
        // Route::post('crowd', "PackageController@crowd");
        Route::get('comment_count', 'PackageController@getCommentCount');
        Route::get('comment', 'PackageController@getComments');
        Route::get('poster', 'PackageController@getPoster');
        Route::get('rebate_rule', 'PackageController@getRebateRule');
        Route::get('discount', 'PackageController@getDiscount');
        Route::get('gift', 'PackageController@getGift');
        Route::get('giftinfo', 'PackageController@getGiftInfo');
        Route::get('tag', 'PackageController@getTag');
        Route::get('check_user', 'PackageController@checkUser');
    });

    Route::group(['prefix' => 'good'], function () {
        Route::post('', "GoodController@getGoodList");
        Route::post('lists', "GoodController@getGoodListShop");
        Route::get('detail', "GoodController@detail");
        Route::post('order', "GoodController@createOrder")->middleware('check.unionid');
        // Route::post('crowd', "GoodController@crowd");
        Route::post('support', "GoodController@support");
        Route::post('shopping_cart', 'GoodController@updateShoppingCart');
        Route::get('shopping_cart', "GoodController@getShoppingCart");
        Route::get('visitor', 'GoodController@visitor');
        Route::get('share', 'GoodController@share');
        Route::get('comment_count', 'GoodController@getCommentCount');
        Route::get('comment', 'GoodController@getComments');
        Route::get('poster', 'GoodController@getPoster');
        Route::get('rebate_rule', 'GoodController@getRebateRule');
        Route::get('discount', 'GoodController@getDiscount');

        Route::get('brand', 'GoodController@getBrand');
        Route::get('tag', 'GoodController@getTag');
        Route::get('check_user', 'GoodController@checkUser');
    });

    Route::group(['prefix' => 'crowd'], function () {
        Route::get('good', 'CrowdController@getGoods');
        Route::get('good_detail', 'CrowdController@getGoodDetail');
        Route::get('', "CrowdController@getList");
        Route::post('', 'CrowdController@createCrowd')->middleware('check.unionid');
        Route::get('detail', 'CrowdController@detail');
        Route::post('support', 'CrowdController@support')->middleware('check.unionid');
        Route::get('support', 'CrowdController@getSupport');
        Route::get('support/status', 'CrowdController@getSupportStatus');

        Route::get('comment_count', 'CrowdController@getCommentCount');
        Route::post('comment', 'CrowdController@comment');
        Route::get('comment', 'CrowdController@getComments');
    });

    Route::group(['prefix' => 'order'], function () {
        Route::get('cancel', "OrderController@cancel");
        Route::get('sendMsg', "OrderController@checkBackSendMsg");
        Route::get('detail', "OrderController@getDetail");
        Route::get('order_detail', "OrderController@getOrderDetail");
        Route::get('list', "OrderController@getList");
        Route::get('status', 'OrderController@getStatus');
        Route::get('combined_order_status', 'OrderController@getCombinedOrderStatus');
        Route::get('combined_order_detail', 'OrderController@getCombinedOrderDetail');
        Route::post('comment', 'OrderController@comment');
        Route::get('finish', 'OrderController@finish');
        Route::post('pay_param', 'OrderController@getPayParam');
        Route::get('recommend', 'OrderController@getRecommend');
    });

    Route::group(['prefix' => 'user'], function () {
        Route::get('base_info', "UserController@getBaseInfo");
        Route::get('info', "UserController@getInfo");
        Route::post('visitor', "UserController@visitor");
        Route::get('unlock', 'UserController@getUnlock');
        Route::get('account', "UserController@getAccount");
        Route::get('account_detail', "UserController@getAccountDetail");
        Route::get('account_rank', "UserController@getAccountRank");
        Route::get('address_list', 'UserController@getAddressList');
        Route::post('address', 'UserController@addAddress')->middleware('check.unionid');
        Route::post('update_address', 'UserController@updateAddress');
        Route::get('default_address', 'UserController@getDefaultAddress');
        Route::get('set_default_address', 'UserController@setDefaultAddress')->middleware('check.unionid');
        Route::post('address/delete', 'UserController@delAddress');
        Route::post('sync_user_info', "UserController@syncUserInfo");
        Route::post('check_referrer', "UserController@checkReferrer");
        Route::get('bind', "UserController@bindUser")->middleware('check.unionid');
        Route::post('mobile', 'UserController@initMobile')->middleware('check.unionid');
        Route::get('apply_partner', 'UserController@applyPartner')->middleware('check.unionid');
        Route::get('partner/application', 'UserController@getPartnerApplication');
        Route::post('referrer_list', 'UserController@getReferrerList');
        Route::get('referrer', 'UserController@getReferrer');
        Route::post('bind_referrer', 'UserController@bindReferrer')->middleware('check.unionid');
        Route::get('invitation_statistic', 'UserController@invitationStatistics');
        Route::get('bank', 'UserController@getBank');
        Route::get('bank/detail', 'UserController@getBankDetail');
        Route::post('bank', 'UserController@setBankInfo')->middleware('check.unionid');
        Route::delete('bank', 'UserController@destoryBankInfo');

        Route::post('apply/withdrawal', 'UserController@applyWithdrawal');
        Route::get('goods_coupon', 'UserController@getGoodsCoupon');
        Route::get('usable_coupon', 'UserController@getUserCouponList');
        Route::get('coupon', 'UserController@getCouponList');
        Route::get('give_coupon', 'UserController@giveCoupon');
        Route::get('visitor/rank', 'UserController@getVisitorRank');
        Route::get('unlock/rank', 'UserController@getUnlockRank');
        Route::get('unlock/rank_shop', 'UserController@getUnlockRankShop');
        Route::get('share/rank', 'UserController@getShareRank') ;
        Route::get('js_sdk_config', 'UserController@getJsSdkConfig');
        Route::get('invited', 'UserController@getInvited');
        Route::get('withdrawal_detail', 'UserController@getWithdrawalDetail');
        Route::get('withdrawal/order', 'UserController@getWithdrawalOrder');
        Route::get('gift/coupon', 'UserController@getGiftCoupon');
        Route::get('take/coupon', 'UserController@takeCoupon')->middleware('check.unionid');
        Route::get('team', 'UserController@getTeam');
        Route::get('search', 'UserController@search');
        Route::get('member', 'UserController@getMemberInfo');
        Route::get('mobile_code', 'UserController@getBindMobileCode');
        Route::get('bind_mobile', 'UserController@bindMobile');
        Route::post('feedback', 'UserController@feedback');
        Route::get('exclusive_service', 'UserController@getExclusiveService');
        Route::get('recharge', 'UserController@getRechargeRecord');//充值记录
        Route::get('balance', 'UserController@getBalanceList');//充值余额门店记录
        Route::get('consume', 'UserController@getConsumeList');//充值记录
        Route::post('update_info', 'UserController@updateUserInfo');//更新用户昵称和头像
    });

    Route::group(['prefix' => 'rebate'], function () {
        Route::get('detail', 'RebateController@getDetail');
        Route::get('team_statistics', 'RebateController@teamStatistics');
        Route::get('team_list', 'RebateController@teamList');
        Route::get('count', 'RebateController@count');
        Route::post('transfer', 'RebateController@transfer');
        Route::get('query_user', 'RebateController@queryUser');
    });
//
//    Route::group(['prefix' => 'free'], function () {
//        Route::get('list', 'FreeController@getList');
//        Route::get('unlock', 'FreeController@getUnlockList');
//    });
    Route::group(['prefix' => 'team'], function () {
        Route::get('ranking_list', 'TeamController@getRankingList');
        Route::get('rank', 'TeamController@getRank');
        Route::get('partner_ranking_list', 'TeamController@getPartnerRankingList');
        Route::get('partner_rank', 'TeamController@getPartnerRank');
        Route::get('lower_rank', 'TeamController@getLowerRank');
        Route::get('statistics', 'TeamController@getStatistics');
        Route::get('rebate', 'TeamController@getRebate');
        Route::get('order', 'TeamController@getOrder');
        Route::get('refresh', 'TeamController@refresh');
        Route::get('search_shop', 'TeamController@getShopList');

    });

    Route::group(['prefix' => 'video'], function () {
        Route::get('', 'VideoController@getList');
        Route::get('detail', 'VideoController@getDetail');
        Route::get('comment', 'VideoController@getComment');
        Route::post('comment', 'VideoController@comment')->middleware('check.unionid');
        Route::post('thumb_up', 'VideoController@thumpUp')->middleware('check.unionid');
        Route::post('reply', 'VideoController@reply')->middleware('check.unionid');
    });

    Route::group(['prefix' => 'manage', 'middleware' => ['auth:api', 'check.manager']], function () {
        Route::post('order', 'ManageController@getOrders');
        Route::post('price', 'ManageController@changePrice');
        Route::post('give', 'ManageController@give');
        Route::post('statistics', 'ManageController@getStatistics');
        Route::post('finish', 'ManageController@orderFinish');
        Route::get('deliver', 'ManageController@deliver');
        Route::post('final_payment', 'ManageController@finalPayment');
        Route::post('cancel_final_payment', 'ManageController@cancelFinalPayment');
        Route::post('rebate_list', 'ManageController@getRebateList');
        Route::post('user_data', 'ManageController@getUserData');
        Route::post('rank', 'ManageController@getRank');
    });
});

